using HKB.Common;
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Diagnostics;
namespace HKB.Data.Dal.S_InvoiceItemTableAdapters
{
	[GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), DataObject(true), HelpKeyword("vs.data.TableAdapter"), Designer("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DesignerCategory("code"), ToolboxItem(true)]
	public class HL_InvoiceItemTableAdapter : Component
	{
		private SqlDataAdapter _adapter;
		private SqlConnection _connection;
		private SqlCommand[] _commandCollection;
		private bool _clearBeforeFill;
		[System.Diagnostics.DebuggerNonUserCode]
		private SqlDataAdapter Adapter
		{
			get
			{
				if (this._adapter == null)
				{
					this.InitAdapter();
				}
				return this._adapter;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		internal SqlConnection Connection
		{
			get
			{
				if (this._connection == null)
				{
					this.InitConnection();
				}
				return this._connection;
			}
			set
			{
				this._connection = value;
				if (this.Adapter.InsertCommand != null)
				{
					this.Adapter.InsertCommand.Connection = value;
				}
				if (this.Adapter.DeleteCommand != null)
				{
					this.Adapter.DeleteCommand.Connection = value;
				}
				if (this.Adapter.UpdateCommand != null)
				{
					this.Adapter.UpdateCommand.Connection = value;
				}
				for (int i = 0; i < this.CommandCollection.Length; i++)
				{
					if (this.CommandCollection[i] != null)
					{
						this.CommandCollection[i].Connection = value;
					}
				}
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		protected SqlCommand[] CommandCollection
		{
			get
			{
				if (this._commandCollection == null)
				{
					this.InitCommandCollection();
				}
				return this._commandCollection;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public bool ClearBeforeFill
		{
			get
			{
				return this._clearBeforeFill;
			}
			set
			{
				this._clearBeforeFill = value;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public HL_InvoiceItemTableAdapter()
		{
			this.ClearBeforeFill = true;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitAdapter()
		{
			this._adapter = new SqlDataAdapter();
			DataTableMapping dataTableMapping = new DataTableMapping();
			dataTableMapping.SourceTable = "Table";
			dataTableMapping.DataSetTable = "HL_InvoiceItem";
			dataTableMapping.ColumnMappings.Add("InvoiceID", "InvoiceID");
			dataTableMapping.ColumnMappings.Add("UserID", "UserID");
			dataTableMapping.ColumnMappings.Add("OrderFormID", "OrderFormID");
			dataTableMapping.ColumnMappings.Add("InvoiceType", "InvoiceType");
			dataTableMapping.ColumnMappings.Add("InvoiceNum", "InvoiceNum");
			dataTableMapping.ColumnMappings.Add("InvoiceTitle", "InvoiceTitle");
			dataTableMapping.ColumnMappings.Add("InvoiceContent", "InvoiceContent");
			dataTableMapping.ColumnMappings.Add("InvoiceDate", "InvoiceDate");
			dataTableMapping.ColumnMappings.Add("TotalMoney", "TotalMoney");
			dataTableMapping.ColumnMappings.Add("Drawer", "Drawer");
			dataTableMapping.ColumnMappings.Add("Inputer", "Inputer");
			dataTableMapping.ColumnMappings.Add("InputTime", "InputTime");
			dataTableMapping.ColumnMappings.Add("SalerID", "SalerID");
			this._adapter.TableMappings.Add(dataTableMapping);
			this._adapter.DeleteCommand = new SqlCommand();
			this._adapter.DeleteCommand.Connection = this.Connection;
			this._adapter.DeleteCommand.CommandText = "DELETE FROM [HLShop_InvoiceItem] WHERE (([InvoiceID] = @Original_InvoiceID))";
			this._adapter.DeleteCommand.CommandType = CommandType.Text;
			this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@Original_InvoiceID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "InvoiceID", DataRowVersion.Original, false, null, "", "", ""));
			this._adapter.InsertCommand = new SqlCommand();
			this._adapter.InsertCommand.Connection = this.Connection;
			this._adapter.InsertCommand.CommandText = "INSERT INTO [HLShop_InvoiceItem] ([UserID], [OrderFormID], [InvoiceType], [InvoiceNum], [InvoiceTitle], [InvoiceContent], [InvoiceDate], [TotalMoney], [Drawer], [Inputer], [InputTime], [SalerID]) VALUES (@UserID, @OrderFormID, @InvoiceType, @InvoiceNum, @InvoiceTitle, @InvoiceContent, @InvoiceDate, @TotalMoney, @Drawer, @Inputer, @InputTime, @SalerID)";
			this._adapter.InsertCommand.CommandType = CommandType.Text;
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@UserID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "UserID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@OrderFormID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "OrderFormID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@InvoiceType", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "InvoiceType", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@InvoiceNum", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "InvoiceNum", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@InvoiceTitle", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "InvoiceTitle", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@InvoiceContent", SqlDbType.NText, 0, ParameterDirection.Input, 0, 0, "InvoiceContent", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@InvoiceDate", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "InvoiceDate", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@TotalMoney", SqlDbType.Money, 0, ParameterDirection.Input, 0, 0, "TotalMoney", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Drawer", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "Drawer", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Inputer", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "Inputer", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@InputTime", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "InputTime", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@SalerID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "SalerID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand = new SqlCommand();
			this._adapter.UpdateCommand.Connection = this.Connection;
			this._adapter.UpdateCommand.CommandText = "UPDATE [HLShop_InvoiceItem] SET [UserID] = @UserID, [OrderFormID] = @OrderFormID, [InvoiceType] = @InvoiceType, [InvoiceNum] = @InvoiceNum, [InvoiceTitle] = @InvoiceTitle, [InvoiceContent] = @InvoiceContent, [InvoiceDate] = @InvoiceDate, [TotalMoney] = @TotalMoney, [Drawer] = @Drawer, [Inputer] = @Inputer, [InputTime] = @InputTime, [SalerID] = @SalerID WHERE (([InvoiceID] = @Original_InvoiceID))";
			this._adapter.UpdateCommand.CommandType = CommandType.Text;
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@UserID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "UserID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@OrderFormID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "OrderFormID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@InvoiceType", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "InvoiceType", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@InvoiceNum", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "InvoiceNum", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@InvoiceTitle", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "InvoiceTitle", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@InvoiceContent", SqlDbType.NText, 0, ParameterDirection.Input, 0, 0, "InvoiceContent", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@InvoiceDate", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "InvoiceDate", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@TotalMoney", SqlDbType.Money, 0, ParameterDirection.Input, 0, 0, "TotalMoney", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Drawer", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "Drawer", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Inputer", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "Inputer", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@InputTime", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "InputTime", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@SalerID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "SalerID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Original_InvoiceID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "InvoiceID", DataRowVersion.Original, false, null, "", "", ""));
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitConnection()
		{
			this._connection = new SqlConnection();
			this._connection.ConnectionString = Conn.CurrenConnectionStrings;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitCommandCollection()
		{
			this._commandCollection = new SqlCommand[5];
			this._commandCollection[0] = new SqlCommand();
			this._commandCollection[0].Connection = this.Connection;
			this._commandCollection[0].CommandText = "SELECT InvoiceID, UserID, OrderFormID, InvoiceType, InvoiceNum, InvoiceTitle, \r\n      InvoiceContent, InvoiceDate, TotalMoney, Drawer, Inputer, InputTime, SalerID\r\nFROM HLShop_InvoiceItem";
			this._commandCollection[0].CommandType = CommandType.Text;
			this._commandCollection[1] = new SqlCommand();
			this._commandCollection[1].Connection = this.Connection;
			this._commandCollection[1].CommandText = "DELETE HLShop_InvoiceItem where InvoiceID  in\r\n(SELECT * FROM fn_Split(@ArrayInvoiceID,','))";
			this._commandCollection[1].CommandType = CommandType.Text;
			this._commandCollection[1].Parameters.Add(new SqlParameter("@ArrayInvoiceID", SqlDbType.VarChar, 1024, ParameterDirection.Input, 0, 0, "", DataRowVersion.Original, false, null, "", "", ""));
			this._commandCollection[2] = new SqlCommand();
			this._commandCollection[2].Connection = this.Connection;
			this._commandCollection[2].CommandText = "SELECT Drawer, InputTime, Inputer, InvoiceContent, InvoiceDate, InvoiceID, InvoiceNum, InvoiceTitle, InvoiceType, OrderFormID, SalerID, TotalMoney, UserID FROM HLShop_InvoiceItem WHERE (InvoiceID = @InvoiceID)";
			this._commandCollection[2].CommandType = CommandType.Text;
			this._commandCollection[2].Parameters.Add(new SqlParameter("@InvoiceID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "InvoiceID", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[3] = new SqlCommand();
			this._commandCollection[3].Connection = this.Connection;
			this._commandCollection[3].CommandText = "SELECT * FROM HLShop_InvoiceItem WHERE (OrderFormID = @OrderFormID)";
			this._commandCollection[3].CommandType = CommandType.Text;
			this._commandCollection[3].Parameters.Add(new SqlParameter("@OrderFormID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "OrderFormID", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[4] = new SqlCommand();
			this._commandCollection[4].Connection = this.Connection;
			this._commandCollection[4].CommandText = "Pr_GetInvoiceBySalerIDUserNameBegindateEndDate";
			this._commandCollection[4].CommandType = CommandType.StoredProcedure;
			this._commandCollection[4].Parameters.Add(new SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[4].Parameters.Add(new SqlParameter("@salerID", SqlDbType.Int, 4, ParameterDirection.Input, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[4].Parameters.Add(new SqlParameter("@userName", SqlDbType.VarChar, 50, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[4].Parameters.Add(new SqlParameter("@BeginDate", SqlDbType.VarChar, 50, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[4].Parameters.Add(new SqlParameter("@EndDate", SqlDbType.VarChar, 50, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[4].Parameters.Add(new SqlParameter("@InvoiceType", SqlDbType.Int, 4, ParameterDirection.Input, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
		}
		[DataObjectMethod(DataObjectMethodType.Select, true), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_InvoiceItem.HL_InvoiceItemDataTable GetAllInvoiceItem()
		{
			this.Adapter.SelectCommand = this.CommandCollection[0];
			S_InvoiceItem.HL_InvoiceItemDataTable hL_InvoiceItemDataTable = new S_InvoiceItem.HL_InvoiceItemDataTable();
			this.Adapter.Fill(hL_InvoiceItemDataTable);
			return hL_InvoiceItemDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_InvoiceItem.HL_InvoiceItemDataTable GetInvoiceByID(int InvoiceID)
		{
			this.Adapter.SelectCommand = this.CommandCollection[2];
			this.Adapter.SelectCommand.Parameters[0].Value = InvoiceID;
			S_InvoiceItem.HL_InvoiceItemDataTable hL_InvoiceItemDataTable = new S_InvoiceItem.HL_InvoiceItemDataTable();
			this.Adapter.Fill(hL_InvoiceItemDataTable);
			return hL_InvoiceItemDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_InvoiceItem.HL_InvoiceItemDataTable GetInvoiceByOrderFormID(int? OrderFormID)
		{
			this.Adapter.SelectCommand = this.CommandCollection[3];
			if (OrderFormID.HasValue)
			{
				this.Adapter.SelectCommand.Parameters[0].Value = OrderFormID.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[0].Value = System.DBNull.Value;
			}
			S_InvoiceItem.HL_InvoiceItemDataTable hL_InvoiceItemDataTable = new S_InvoiceItem.HL_InvoiceItemDataTable();
			this.Adapter.Fill(hL_InvoiceItemDataTable);
			return hL_InvoiceItemDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_InvoiceItem.HL_InvoiceItemDataTable GetInvoiceBySalerIDUserNameBegindateEndDate(int? salerID, string userName, string BeginDate, string EndDate, int? InvoiceType)
		{
			this.Adapter.SelectCommand = this.CommandCollection[4];
			if (salerID.HasValue)
			{
				this.Adapter.SelectCommand.Parameters[1].Value = salerID.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[1].Value = System.DBNull.Value;
			}
			if (userName == null)
			{
				this.Adapter.SelectCommand.Parameters[2].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[2].Value = userName;
			}
			if (BeginDate == null)
			{
				this.Adapter.SelectCommand.Parameters[3].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[3].Value = BeginDate;
			}
			if (EndDate == null)
			{
				this.Adapter.SelectCommand.Parameters[4].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[4].Value = EndDate;
			}
			if (InvoiceType.HasValue)
			{
				this.Adapter.SelectCommand.Parameters[5].Value = InvoiceType.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[5].Value = System.DBNull.Value;
			}
			S_InvoiceItem.HL_InvoiceItemDataTable hL_InvoiceItemDataTable = new S_InvoiceItem.HL_InvoiceItemDataTable();
			this.Adapter.Fill(hL_InvoiceItemDataTable);
			return hL_InvoiceItemDataTable;
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(S_InvoiceItem.HL_InvoiceItemDataTable dataTable)
		{
			return this.Adapter.Update(dataTable);
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(S_InvoiceItem dataSet)
		{
			return this.Adapter.Update(dataSet, "HL_InvoiceItem");
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow dataRow)
		{
			return this.Adapter.Update(new DataRow[]
			{
				dataRow
			});
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow[] dataRows)
		{
			return this.Adapter.Update(dataRows);
		}
		[DataObjectMethod(DataObjectMethodType.Delete, true), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Delete(int Original_InvoiceID)
		{
			this.Adapter.DeleteCommand.Parameters[0].Value = Original_InvoiceID;
			ConnectionState state = this.Adapter.DeleteCommand.Connection.State;
			if ((this.Adapter.DeleteCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				this.Adapter.DeleteCommand.Connection.Open();
			}
			int result;
			try
			{
				int num = this.Adapter.DeleteCommand.ExecuteNonQuery();
				result = num;
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					this.Adapter.DeleteCommand.Connection.Close();
				}
			}
			return result;
		}
		[DataObjectMethod(DataObjectMethodType.Insert, true), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Insert(int? UserID, int? OrderFormID, int? InvoiceType, string InvoiceNum, string InvoiceTitle, string InvoiceContent, System.DateTime? InvoiceDate, decimal? TotalMoney, string Drawer, string Inputer, System.DateTime? InputTime, int? SalerID)
		{
			if (UserID.HasValue)
			{
				this.Adapter.InsertCommand.Parameters[0].Value = UserID.Value;
			}
			else
			{
				this.Adapter.InsertCommand.Parameters[0].Value = System.DBNull.Value;
			}
			if (OrderFormID.HasValue)
			{
				this.Adapter.InsertCommand.Parameters[1].Value = OrderFormID.Value;
			}
			else
			{
				this.Adapter.InsertCommand.Parameters[1].Value = System.DBNull.Value;
			}
			if (InvoiceType.HasValue)
			{
				this.Adapter.InsertCommand.Parameters[2].Value = InvoiceType.Value;
			}
			else
			{
				this.Adapter.InsertCommand.Parameters[2].Value = System.DBNull.Value;
			}
			if (InvoiceNum == null)
			{
				this.Adapter.InsertCommand.Parameters[3].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.InsertCommand.Parameters[3].Value = InvoiceNum;
			}
			if (InvoiceTitle == null)
			{
				this.Adapter.InsertCommand.Parameters[4].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.InsertCommand.Parameters[4].Value = InvoiceTitle;
			}
			if (InvoiceContent == null)
			{
				this.Adapter.InsertCommand.Parameters[5].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.InsertCommand.Parameters[5].Value = InvoiceContent;
			}
			if (InvoiceDate.HasValue)
			{
				this.Adapter.InsertCommand.Parameters[6].Value = InvoiceDate.Value;
			}
			else
			{
				this.Adapter.InsertCommand.Parameters[6].Value = System.DBNull.Value;
			}
			if (TotalMoney.HasValue)
			{
				this.Adapter.InsertCommand.Parameters[7].Value = TotalMoney.Value;
			}
			else
			{
				this.Adapter.InsertCommand.Parameters[7].Value = System.DBNull.Value;
			}
			if (Drawer == null)
			{
				this.Adapter.InsertCommand.Parameters[8].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.InsertCommand.Parameters[8].Value = Drawer;
			}
			if (Inputer == null)
			{
				this.Adapter.InsertCommand.Parameters[9].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.InsertCommand.Parameters[9].Value = Inputer;
			}
			if (InputTime.HasValue)
			{
				this.Adapter.InsertCommand.Parameters[10].Value = InputTime.Value;
			}
			else
			{
				this.Adapter.InsertCommand.Parameters[10].Value = System.DBNull.Value;
			}
			if (SalerID.HasValue)
			{
				this.Adapter.InsertCommand.Parameters[11].Value = SalerID.Value;
			}
			else
			{
				this.Adapter.InsertCommand.Parameters[11].Value = System.DBNull.Value;
			}
			ConnectionState state = this.Adapter.InsertCommand.Connection.State;
			if ((this.Adapter.InsertCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				this.Adapter.InsertCommand.Connection.Open();
			}
			int result;
			try
			{
				int num = this.Adapter.InsertCommand.ExecuteNonQuery();
				result = num;
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					this.Adapter.InsertCommand.Connection.Close();
				}
			}
			return result;
		}
		[DataObjectMethod(DataObjectMethodType.Update, true), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(int? UserID, int? OrderFormID, int? InvoiceType, string InvoiceNum, string InvoiceTitle, string InvoiceContent, System.DateTime? InvoiceDate, decimal? TotalMoney, string Drawer, string Inputer, System.DateTime? InputTime, int? SalerID, int Original_InvoiceID)
		{
			if (UserID.HasValue)
			{
				this.Adapter.UpdateCommand.Parameters[0].Value = UserID.Value;
			}
			else
			{
				this.Adapter.UpdateCommand.Parameters[0].Value = System.DBNull.Value;
			}
			if (OrderFormID.HasValue)
			{
				this.Adapter.UpdateCommand.Parameters[1].Value = OrderFormID.Value;
			}
			else
			{
				this.Adapter.UpdateCommand.Parameters[1].Value = System.DBNull.Value;
			}
			if (InvoiceType.HasValue)
			{
				this.Adapter.UpdateCommand.Parameters[2].Value = InvoiceType.Value;
			}
			else
			{
				this.Adapter.UpdateCommand.Parameters[2].Value = System.DBNull.Value;
			}
			if (InvoiceNum == null)
			{
				this.Adapter.UpdateCommand.Parameters[3].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.UpdateCommand.Parameters[3].Value = InvoiceNum;
			}
			if (InvoiceTitle == null)
			{
				this.Adapter.UpdateCommand.Parameters[4].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.UpdateCommand.Parameters[4].Value = InvoiceTitle;
			}
			if (InvoiceContent == null)
			{
				this.Adapter.UpdateCommand.Parameters[5].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.UpdateCommand.Parameters[5].Value = InvoiceContent;
			}
			if (InvoiceDate.HasValue)
			{
				this.Adapter.UpdateCommand.Parameters[6].Value = InvoiceDate.Value;
			}
			else
			{
				this.Adapter.UpdateCommand.Parameters[6].Value = System.DBNull.Value;
			}
			if (TotalMoney.HasValue)
			{
				this.Adapter.UpdateCommand.Parameters[7].Value = TotalMoney.Value;
			}
			else
			{
				this.Adapter.UpdateCommand.Parameters[7].Value = System.DBNull.Value;
			}
			if (Drawer == null)
			{
				this.Adapter.UpdateCommand.Parameters[8].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.UpdateCommand.Parameters[8].Value = Drawer;
			}
			if (Inputer == null)
			{
				this.Adapter.UpdateCommand.Parameters[9].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.UpdateCommand.Parameters[9].Value = Inputer;
			}
			if (InputTime.HasValue)
			{
				this.Adapter.UpdateCommand.Parameters[10].Value = InputTime.Value;
			}
			else
			{
				this.Adapter.UpdateCommand.Parameters[10].Value = System.DBNull.Value;
			}
			if (SalerID.HasValue)
			{
				this.Adapter.UpdateCommand.Parameters[11].Value = SalerID.Value;
			}
			else
			{
				this.Adapter.UpdateCommand.Parameters[11].Value = System.DBNull.Value;
			}
			this.Adapter.UpdateCommand.Parameters[12].Value = Original_InvoiceID;
			ConnectionState state = this.Adapter.UpdateCommand.Connection.State;
			if ((this.Adapter.UpdateCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				this.Adapter.UpdateCommand.Connection.Open();
			}
			int result;
			try
			{
				int num = this.Adapter.UpdateCommand.ExecuteNonQuery();
				result = num;
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					this.Adapter.UpdateCommand.Connection.Close();
				}
			}
			return result;
		}
		[DataObjectMethod(DataObjectMethodType.Delete, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int DeleteInvoice(string ArrayInvoiceID)
		{
			SqlCommand sqlCommand = this.CommandCollection[1];
			if (ArrayInvoiceID == null)
			{
				throw new System.ArgumentNullException("ArrayInvoiceID");
			}
			sqlCommand.Parameters[0].Value = ArrayInvoiceID;
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
	}
}
